<ui:composition xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"
        template="template.xhtml">
    <ui:define name="title">Shows</ui:define>
    <ui:define name="content">
        <div class="content ui-widget ui-widget-content ui-corner-all">
            <h:form>
                <p>
                    <h:commandButton value="Add Show" action="addShow.xhtml?faces-redirect=true" />
                </p>
	            <h:dataTable rendered="#{not empty showBean.shows}"
	                    value="#{showBean.shows}" var="show" rules="all"
                    styleClass="boxed" width="50%"
                    headerClasses="name,info,status"
                    columnClasses="name,info,status"
                    rowClasses="odd,even">
	                <h:column>
	                    <f:facet name="header">Name</f:facet>
	                    <h:commandLink value="#{show.name}" action="listEpisodes?faces-redirect=true">
	                        <f:setPropertyActionListener target="#{episodeBean.show}" value="${show}" />
	                    </h:commandLink>
	                </h:column>
                    <h:column>
                        <f:facet name="header">Info</f:facet>
                        <h:outputLink value="#{show.link}" target="_new">Info</h:outputLink>  
                    </h:column>
                    <h:column>
                        <f:facet name="header">Status</f:facet>
                        <h:outputText value="#{show.status.name}" />
                    </h:column>
	            </h:dataTable>
	            <h:outputText value="No shows configured." rendered="#{empty showBean.shows}" />
            </h:form>            
        </div>
    </ui:define>
</ui:composition>
